﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Zarion_Quest.MENU;
using Zarion_Quest.Base;
using Zarion_Quest.CREDITS;
using Zarion_Quest.GAMEOVER;
using Zarion_Quest.LEVELS;
using Zarion_Quest.PAUSE;
using Zarion_Quest.THEEND;

namespace Zarion_Quest.INTRO
{
    class Intro:Scene
    {
        Video videoIntro;

        VideoPlayer videoPlayer;

        SpriteFont arial14;

        public Intro()
            : base(
            "Content/INTRO/Background", //a imagem de fundo da cena
            "Content/INTRO/Intro")//a musica de fundo da cena
        {
            //carregamento pelo content estatico em game1
            //videoIntro = Game1.Self.Content.Load<Video>("Content/INTRO/video");
            
            videoPlayer = new VideoPlayer();

            arial14 = Game1.Self.Content.Load<SpriteFont>("Content/base/arial14");
            
            //videoPlayer.Play(videoIntro);
            
        }
        
        public override void Update(GameTime gameTime)
        {
            //TEM QUE FICAR ANTES DA LINHA DE BAIXO!!!
            if (MediaPlayer.State != MediaState.Playing)
            {
                MediaPlayer.Play(background_music);
            }

            if (Game1.isPressed(Keys.Enter))//||videoPlayer.State == MediaState.Stopped)
            {
                videoPlayer.Stop();

                MediaPlayer.Stop();

                Game1.currentScreen = Game1.Screen.MENU;
            }
        }

        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(background, Vector2.Zero, Color.White);

            //para chamar a textura/imagem que está sendo tocada no vídeo para aparecer
            //spriteBatch.Draw(videoPlayer.GetTexture(),
            //    new Rectangle(0,0, Game1.Self.Window.ClientBounds.Width, Game1.Self.Window.ClientBounds.Height),
            //   Color.White);

            spriteBatch.DrawString(arial14, "Press F11 to fullscreen          Press Enter to skip",
                new Vector2(Game1.Self.Window.ClientBounds.Width
                    - arial14.MeasureString("Press F11 to fullscreen          Press Enter to skip").X - 10,
                    Game1.Self.Window.ClientBounds.Height - arial14.MeasureString("A").Y - 10), Color.Yellow);

            //base?
        }
        
    }
}
